﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace Snake.Model
{
    class Bonus
    {
        private int nb_next_bonus = 5 ;
        private int actuall_bonus = 0;
        private Point coord;
        private Random rand = new Random();
        private PictureBox Picture = new PictureBox();

        public int GetNb_next_Bonus()
        {
            return this.nb_next_bonus; 
        }

        public Point coords
        {
            get { return this.coord; }
            set { this.coord = value; }
        }

        public PictureBox Pictures
        {
            get { return this.Picture; }
            set { this.Picture = value; }
        }

        public Bonus()
        {

            //GESTION POMME ALEATOIRE
            //permet d'obtenir un random entre 0-390 seulement en 10 pour allignement serpent
            int RNX_1 = rand.Next(0, 3);
            RNX_1 = RNX_1 * 100;
            int RNX_2 = rand.Next(0, 9);
            RNX_2 = RNX_2 * 10;
            int RNX = RNX_1 + RNX_2;

            //permet d'obtenir un random entre 0-390 seulement en 10 pour allignement serpent
            int RNY_1 = rand.Next(0, 2);
            RNY_1 = RNY_1 * 100;
            int RNY_2 = rand.Next(0, 9);
            RNY_2 = RNY_2 * 10;
            int RNY = RNY_1 + RNY_2;

            this.coord = new Point(RNX, RNY);
            //Picture.Visible = false;
            Picture.SetBounds(this.coord.X,this.coord.Y,10,10);
            Picture.Load("./../../Ressource/Bonus.png");
        }

        public void BonusManger()
        {
            //GESTION POMME ALEATOIRE
            //permet d'obtenir un random entre 0-390 seulement en 10 pour allignement serpent
            int RNX_1 = rand.Next(0, 3);
            RNX_1 = RNX_1 * 100;
            int RNX_2 = rand.Next(0, 9);
            RNX_2 = RNX_2 * 10;
            int RNX = RNX_1 + RNX_2;

            //permet d'obtenir un random entre 0-390 seulement en 10 pour allignement serpent
            int RNY_1 = rand.Next(0, 2);
            RNY_1 = RNY_1 * 100;
            int RNY_2 = rand.Next(0, 9);
            RNY_2 = RNY_2 * 10;
            int RNY = RNY_1 + RNY_2;

            this.coord.X = RNX;
            this.coord.Y = RNY;
            this.Picture.Visible = false;
            Picture.SetBounds(this.coord.X, this.coord.Y, 10, 10);
        }


        public Boolean IncrementeBonus()
        {
            if (actuall_bonus == nb_next_bonus)
            {
                actuall_bonus = 0;
                nb_next_bonus = nb_next_bonus + 2;
                return true;
            }
            else
            {
                actuall_bonus++;
                return false;
            }
        }

    }
}
